package util;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;

/**
 * User: Vladimir
 * Date: 03.10.12 Time: 16:22
 */
public class CompatibilityGrabber {
    public static void main(String[] args) throws IOException {
        String firm = "Nokia";
        String model = "WH-701";
        String type = "headsets";
        String url = "http://mobistyle.com.ua/?action=showmobileacc&type=%s&firm=%s&model=%s&page=compatibility";
        url = String.format(url, type, firm, model);
        System.out.println(url);
        Document doc = Jsoup.connect(url).timeout(10000).get();
        Elements elems = doc.select("a.sacc_comp_lnk");
        for (Element elem : elems) {
            System.out.print(elem.text().replace(firm,"").trim() + ",");
        }
    }
}
